home *** CD-ROM | disk | FTP | other *** search
- ((Techtips figure 1 - Routine to Identify Intel Processors))
-
- proc_type proc near
-
- pushf ;save flags
- xor ax,ax ;clear AX
- push ax ;push it on stack
- popf ;zero the flags
- pushf ;try to zero bits 12-15
- pop ax ;recover flags
- and ax,0f000h ;if 12-15 are 1
- cmp ax,0f000h ;then processor is
- jz is_0_1 ;8018x or 808x
-
- mov ax,07000h ;try to set bits 12-14
- push ax
- popf
- pushf
- pop ax
- and ax,07000h ;if 12-14 are 0
- jz is_80286 ;processor is 80286
-
- is_80386: ;else it's an 80386
- mov ax,386h ;return 386
- jmp done
-
- is_80286:
- mov ax,286h ;return 286
- jmp done
-
- is_0_1: ;it's 808x or 8018x
- push cx ;save it
- mov ax,0ffffh ;set all AX bits
- mov cl,33 ;will shift once on 8018x
- shl ax,cl ;or 33 times on 808x
- jnz is_80186 ;nonzero bits mean 8018x
-
- is_8086: ;else it's 808x
- mov ax,86h ;return 86
- pop cx ;restore CX
- jmp done
-
- is_80186:
- mov ax,186h ;return 186
- pop cx ;restore CX
-
- done:
- popf ;restore original flags
- ret
-
- proc_type endp
-